import { createApp } from 'vue';
import { createPinia } from 'pinia';
import AntD from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';

// pinia持久层插件导入
import persist from 'pinia-plugin-persistedstate';

import App from './App.vue';
import router from './router';
import directivePlugin from '@/directive';

// 导入权限
import '@/permission';
// 导入icons图标
import icons from '@/components/icons';
import { initDynamicRoutes } from '@/permission';

const app = createApp(App);

app.use(createPinia().use(persist));
initDynamicRoutes(); // 一定在app.use(router)挂着前初始化，否则会出现空白页
app.use(router);
app.use(AntD);
app.use(icons);
app.use(directivePlugin);
app.mount('#app');
